/**
 * Created by bo.wang on 2022/3/6.
 */
import React, {useState} from 'react'
import styles from './Test.module.scss'
import {Stage, Layer, Tag, Label, Text} from "react-konva"

const Test = () => {

    const [width, setWidth] = useState<number | undefined>(0)
    const [height, setHeight] = useState<number | undefined>(0)

    return (
        <div
            ref={ref => {
                setWidth(ref?.clientWidth)
                setHeight(ref?.clientHeight)
            }}
            className={styles.container}>
            <Stage width={width} height={height}>
                <Layer>
                    <Label x={0} y={0} draggable>
                        <Tag cornerRadius={5} fill={'red'}/>
                        <Text text={'hello world 1'} padding={10}/>
                    </Label>
                </Layer>
            </Stage>
        </div>
    )
}

export default Test